<template>
  <div>
    <h1>TestLifeHook</h1>
    <button @click="handleChange">改变</button>
    <button @click="handleVisible">销毁</button>
    <parent v-if="show" :msg="msg"></parent>
  </div>
</template>

<script>
import Parent from "../components/Parent.vue";

export default {
  components: { Parent },
  data() {
    return {
        show: true,
      msg: "apple",
      sources: ["apple", "pear", "banana", "mongo"],
    };
  },
  methods: {
    handleChange() {
      this.msg = this.sources[Math.round(Math.random * 3)];
    },
    handleVisible(){
        this.show = !this.show;
    }
  },
};
</script>
